package com.zjc.utils.collection;

import com.google.gson.reflect.TypeToken;
import com.zjc.utils.convert.CopyUtils;
import lombok.Data;

/**
 * 可更新LinkedBlockingQueue工具适配器实现示例
 *
 * @author zjc
 * @date 2022-07-1 09:47
 */
@Data
public class KeyLinkedBlockingQueueValue implements KeyLinkedBlockingQueueAdapter {

    private String uniqueNo;

    private String time;


    @Override
    public String getKey() {
        return uniqueNo;
    }

    @Override
    public void update(KeyLinkedBlockingQueueAdapter newData) {
        KeyLinkedBlockingQueueValue v = CopyUtils.deepCopy(newData, new TypeToken<KeyLinkedBlockingQueueValue>() {
        });
        this.uniqueNo = v.getUniqueNo();
        this.time = v.getTime();
    }
}
